package com.example.demo.util;

import junit.framework.TestCase;
import junit.textui.TestRunner;

public class TestGeneratePrimesV1 extends TestCase {

    public static void main(String[] args) {
        TestRunner.main(new String[]{"TestGeneratePrimes"});
    }

    public TestGeneratePrimesV1(String name){
        super(name);
    }

    public void testPrimes(){
        int[] nullArray = PrimeGeneratorV2.generatePrimes(0);
        assertEquals(nullArray.length,0);
        int[] minArray = PrimeGeneratorV2.generatePrimes(2);
        assertEquals(minArray.length,1);
        assertEquals(minArray[0],2);
        int[] threeArray = PrimeGeneratorV2.generatePrimes(3);
        assertEquals(threeArray.length,2);
        assertEquals(threeArray[0],2);
        assertEquals(threeArray[1],3);

        int[] centArray = PrimeGeneratorV2.generatePrimes(100);
        assertEquals(centArray.length,25);
        assertEquals(centArray[24],97);

    }
}
